<?php

use think\facade\Route;
use Symfony\Component\Finder\Finder;

Route::rest([
    'index'   => ['GET', '', 'list'],
    'read' => ['GET', '/:id', 'detail'],
    'save' => ['POST', '', 'add'],
    'update' => ['PUT', '/:id', 'edit'],
    'delete' => ['DELETE', '/:id', 'delete'],
]);


Route::group('admin', function () {
    // 上传图片到本地，并且不公开
    Route::post('index/localUpload', 'admin.Index/localUpload');

    // 分类选择
    Route::get('category/select', 'admin.Category/select');
    Route::get('category/goodsSelect', 'admin.Category/goodsSelect');

    // 配送选择
    Route::get('dispatch/dispatch/select', 'admin.dispatch.Dispatch/select');

    // 团购商品
    Route::group(function () {
        // 团购商品
        Route::get('goods/category_list', 'admin.goods.Goods/category_list');
        Route::get('goods/hair_list', 'admin.goods.Goods/hair_list');
        Route::post('goods/statusEdit', 'admin.goods.Goods/statusEdit');
        Route::post('goods/inStock', 'admin.goods.Goods/inStock');
        Route::post('goods/outStock', 'admin.goods.Goods/outStock');
        Route::resource('goods', 'admin.goods.Goods');

        // 团购订单
        Route::get('order/list', 'admin.order.Order/list');
        Route::get('order/getType', 'admin.order.Order/getType');
        Route::get('order/detail/:id', 'admin.order.Order/detail');
        Route::get('order/detailLog/:id', 'admin.order.Order/detailLog');

        // 售后
        Route::get('order/aftersale', 'admin.order.Order/aftersale');
        Route::get('order/aftersale_detail/:id', 'admin.order.Order/aftersale_detail');
        Route::get('order/aftersale_log/:id', 'admin.order.Order/aftersale_log');
        // 核销
        Route::get('write_off/list', 'admin.order.WriteOff/list');
        Route::get('write_off/writeOff', 'admin.order.WriteOff/writeOff');

    });

    Route::group(function () {
        Route::get('dashboard/total', 'admin.Dashboard/total');
        Route::get('dashboard/chart', 'admin.Dashboard/chart');
        Route::get('dashboard/ranking', 'admin.Dashboard/ranking');

        // 问题反馈
        Route::resource('feedback', 'admin.feedback');


    })->middleware('check_rule', 'admin');


})->middleware('check_login', 'admin');
